<?php
require_once __Dir__ . '/../simpletest/autorun.php';
require_once __Dir__ . '/../../Core/BonoHomeCore/BonoHomeCoreService.php';

class TestOfUpdateOperation extends UnitTestCase 
{
	/*
		Check a correct add answer
	*/
    function testCorrectUpdateOperation() 
	{
		$accountName = "test account";
		$service = new BonoHomeCoreService();
		$date1 = DateTime::createFromFormat('d/m/Y', "01/01/2014");
		$startDate = $date1->format('Y-m-d');
		$date2 = DateTime::createFromFormat('d/m/Y', "30/12/2014");
		$endDate = $date2->format('Y-m-d');
		$operations = $service->getOperations($accountName, $startDate, $endDate);
		
		if(count($operations->response) > 0)
		{
			$id = $operations->response[0]->Id;
			$type = $operations->response[0]->Type;
			$status = $operations->response[0]->Status;
			$paymentMean = $operations->response[0]->PaymentMean;
			$category = $operations->response[0]->Category;
			$expectedamount = $operations->response[0]->Expectedamount;
			$realamount = $operations->response[0]->Realamount;
			$operationdate = $operations->response[0]->Operationdate;
			$isRecurring = $operations->response[0]->IsRecurring;
			
			$result = $service->updateOperation($id, $label, $type, $status, $paymentMean, $category, $expectedamount, $realamount, $operationdate, $isRecurring);
			$this->assertTrue($result->isFailed == false);
		}
		else
		{
			$this->assertTrue(false);
		}
    }
	
	
	/*
		Check an invalid add answer
	*/
    function testInvalidUpdateOperation() 
	{
    }
}
?>